package org.linlinjava.litemall.admin.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.IdentityCard;
import org.linlinjava.litemall.db.domain.LitemallCategory;
import org.linlinjava.litemall.db.service.IdentityCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/IdentityCard")
@Validated
public class IdentityCardController {

	@Autowired
	private IdentityCardService IdentityCardService;
	
	
    @RequiresPermissions("admin:IdentityCard:list")
    @RequiresPermissionsDesc(menu = {"商场管理", "类目管理"}, button = "查询")
    @GetMapping("/list")
    public Object list(
    		@RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer limit) {

        List<IdentityCard> categoryList = IdentityCardService.queryByPid(0,page,limit);
        return ResponseUtil.okList(categoryList);
        }
    
    @RequiresPermissions("admin:IdentityCard:detail")
    @RequiresPermissionsDesc(menu = {"商场管理", "类目管理"}, button = "查询")
    @GetMapping("/detail")
    public Object detail(Integer id) {
		Map<String, Object> data = new HashMap<>();
		data.put("listIdentity", IdentityCardService.selectMember(id));
    	return ResponseUtil.ok(data);
     }
}
